package com.clkj.xiuzheng.service;

import com.alibaba.fastjson.JSONObject;
import com.clkj.xiuzheng.config.CloseTask;
import com.clkj.xiuzheng.dao.*;
import com.clkj.xiuzheng.pojo.*;
import com.clkj.xiuzheng.pojo.common.*;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.tomcat.util.threads.ThreadPoolExecutor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartRequest;
import tk.mybatis.mapper.entity.Example;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.util.concurrent.*;

/**
 * @author yawang
 * @create 2024/04/12 10:16:16
 **/
@Service("UserServiceImpl")
public class UserServiceImpl implements UserService{

    @Autowired
    private UserMapper userMapper;
    @Autowired
    private UserPutMapper userPutMapper;
    @Autowired
    private ShopMapper shopMapper;
    @Autowired
    private OutStockMapper outStockMapper;
    @Autowired
    private CustomerVisitMapper customerVisitMapper;
    @Autowired
    private AreaMapper areaMapper;
    @Autowired
    private ShopVisitMapper shopVisitMapper;
    @Autowired
    private SettingMapper settingMapper;

    @Autowired
    private RedisTemplate redisTemplate;

    @Autowired
    private UserMiniMapper userMiniMapper;

    private Map map;
//    private String appId = "wx9cf9f21ba0cbf62b";
//    private String appSecret = "7fbb7cbc5220cbea81f8d0bca6c2e2df";
    @Override
    public Map login(String code) {


        map = new HashMap();
        String access_token = "";
        String unionid = "";
        String urls = "https://api.weixin.qq.com/sns/oauth2/access_token?appid="
                + WxApi.getWxAppId()
                + "&secret="
                + WxApi.getWxAppSecret()
                + "&code="
                + code
                + "&grant_type=authorization_code";
        JSONObject json = Util.getResult(urls);
        access_token = json.getString("access_token");
        String openid_id = json.getString("openid");
        if(openid_id==null){
            map.put("flag","error");
            map.put("msg","openId获取失败，需要跳转到登录页面重新获取");
            return map;
        }
//        String user_url = "https://api.weixin.qq.com/sns/userinfo?access_token="
//                + access_token + "&openid=" + openid_id + "&lang=zh_CN";
//        JSONObject userInfo = Util.getResult(user_url);
        Example example = new Example(User.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("openId",openid_id);
        User users = userMapper.selectOneByExample(example);
        if (users != null) {
            map.put("flag","success");
            map.put("user",users);
            map.put("dateTime", DateFormatHelper.today());
            return map;
        }
        else {
            map.put("flag","true");
            map.put("openId",openid_id);
            map.put("dateTime",DateFormatHelper.today());
            return map;
        }
    }

    @Override
    public Map addOrder(User user) {
        if(user.getUserId()==null){
            user.setUserBalance(0.0);
            userMapper.addUser(user);
        }
        UserPut put = user.getUserPut();
        put.setIsPut(0);
        put.setUserId(user.getUserId());
        put.setPutDate(DateFormatHelper.currentTimes());
        put.setIsContact(0);
        put.setPromoterId(user.getPromoterId());
        userPutMapper.addUserPut(put);
        map = new HashMap<String, String>();
        map.put("flag","true");
        map.put("user",user);
        map.put("recordId",put.getRecordId());
        return map;
    }

    @Override
    public Map listMyUserPut(Integer userId) {
        Example example = new Example(UserPut.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("userId",userId);
        List<UserPut> puts= userPutMapper.selectByExample(example);
        map = new HashMap();
        map.put("puts",puts);
//        String []shops = shopId.split(",");
//        example = new Example(UserPut.class);
//        criteria = example.createCriteria();
//        criteria.andIn("shopId", Arrays.asList(shops));
//        List<Shop> shopList = shopMapper.selectByExample(example);
//        map = new HashMap<String, Shop>();
//        map.put("shopList", shopList);
        return map;
    }

    @Override
    public List<Shop> listMyPutShop(Integer recordId) {
        UserPut puts= userPutMapper.selectByPrimaryKey(recordId);
        String []shops = puts.getShopId().split(",");
        Example example = new Example(UserPut.class);
       Example.Criteria criteria = example.createCriteria();
        criteria.andIn("shopId", Arrays.asList(shops));
        List<Shop> shopList = shopMapper.selectByExample(example);
        map = new HashMap<String, Shop>();


        return shopList;
    }

    @Override
    public void applyUserPut(Integer recordId) {
        UserPut put = userPutMapper.selectByPrimaryKey(recordId);
        userPutMapper.updateByPrimaryKeySelective(put);
        Example example = new Example(Shop.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andIn("shopId",Arrays.asList(put.getShopId().split(",")));
        Shop shop = new Shop();
        shop.setStartTime(put.getStartTime());
        shop.setEndTime(put.getEndTime());
        shop.setShopAdvert(put.getPutAdv());
        shop.setShopStatus("1");
        shopMapper.updateByExampleSelective(shop,example);
        put.setIsPut(1);
        userPutMapper.updateByPrimaryKeySelective(put);

        redisTemplate.delete("recordId"+recordId+"");
    }

    @Override
    public PageInfo getAllUser(Integer pageSize, Integer pageNum) {
        PageHelper.startPage(pageNum,pageSize);
        List<User> list = userMapper.getAllUser();
        return new PageInfo(list);
    }

    @Override
    public UserInfoVo getUserInfo(Integer userId) {
        //启用线程池
        ThreadPoolExecutor executor = new ThreadPoolExecutor(
                10,
                50,
                60,
                TimeUnit.SECONDS,
                new LinkedBlockingQueue<>(100000),
                Executors.defaultThreadFactory(),
                new ThreadPoolExecutor.AbortPolicy());
        UserInfoVo userInfoVo=  new UserInfoVo();

        CompletableFuture<Integer> future1 = CompletableFuture.supplyAsync(() -> {
            Integer todayVisit = customerVisitMapper.getTodayVisit(userId);
           return todayVisit;
        }, executor);
        CompletableFuture<Double> future2 = CompletableFuture.supplyAsync(() -> {
            Double todaySales = outStockMapper.getTodaySales(userId);
            return todaySales;
        }, executor);
        CompletableFuture<Integer> future3 = CompletableFuture.supplyAsync(() -> {
            Integer monthVisit = customerVisitMapper.getMonthVisit(userId);
            return monthVisit;
        }, executor);
        CompletableFuture<Double> future4 = CompletableFuture.supplyAsync(() -> {
            Double monthSales = outStockMapper.getMonthSales(userId);
            return monthSales;
        }, executor);
        try {
            userInfoVo.setTodayVisitNum(future1.join());
            userInfoVo.setTodayTotalSales(future2.join());
            userInfoVo.setMonthVisitNum(future3.join());
            userInfoVo.setMonthTotalSales(future4.join());
        } catch (RuntimeException e) {
            // 处理异常，可能由于等待过程中线程被中断或执行过程中出现异常
            e.printStackTrace();
        }

        return userInfoVo;
    }

    @Override
    public Map getUserSaleRanking(Integer companyId) {
        //查询销售员销售排行
        List<UserSaleAndVisitVo> list = userMapper.getUserSaleRanking(companyId);
        //查询销售员拜访排名
        List<UserSaleAndVisitVo> list2 = userMapper.getUserVisitRanking(companyId);
        Map map = new HashMap();
        map.put("saleList",list);
        map.put("visitList",list2);
        return map;
    }

    @Override
    public List<User> getSaleUser(Integer companyId,Integer flag) {
        Example example = new Example(User.class);
        Example.Criteria criteria = example.createCriteria();
        if(flag==0){
            criteria.andEqualTo("companyId",companyId).andCondition(" user_tag in (-1,1)");
        }else{
            criteria.orEqualTo("userTag",-2).orEqualTo("userTag",-3);
        }

       return userMapper.selectByExample(example);
    }

    @Override
    @Transactional(rollbackFor = Exception.class, noRollbackFor = RuntimeException.class)
    public void addUser(User user,String areaIdList) {
        user.setUserPassword("123456");

        userMapper.addUser(user);
        if(user.getUserTag()==-2){
            //生成二维码
            String url = "https://www.ccclkj.cn/xiuzheng/#/?saleManId=" +user.getUserId();
            String path = "D:\\nginx-1.19.1\\html\\zhibanzhang\\resource\\xiuzheng/er";
            String pic = Util.creatPic(url, user.getUserId().toString(), path, user.getUserName());
            String reason = user.getUserId().toString() + ".png";
            UserImg userImg = new UserImg();
            userImg.setUserImg(reason);
            userImg.setUserId(user.getUserId());
            userMapper.addImg(userImg);
        }

        String [] areas = areaIdList.split(",");
        Area area =null;
        List<Area> areaList = new ArrayList<>();
        for (String area1 : areas) {
            area  = new Area();
            area.setUserId(user.getUserId());
            area.setIsDeleted(1);
            area.setAreaId(Integer.parseInt(area1));
            areaList.add(area);
        }
        areaMapper.insertList(areaList);


//      userMapper.addSaleUser(user);
    }

    @Override
    public void updateUserUp(Integer userId,Integer status) {
        User user  = new User();
        user.setUserStatus(status);
        user.setUserId(userId);
        userMapper.updateByPrimaryKeySelective(user);
    }

    @Override
    public List<UserPut> getSaleUserOrder(Integer promoterId) {
        if (promoterId==0){
            return userPutMapper.getAllSaleUserOrder();
        }
       /* Example example = new Example(UserPut.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("promoterId",promoterId);
        List<UserPut> userPuts = userPutMapper.selectByExample(example);*/
        List<UserPut> userPuts = userPutMapper.getSaleUserOrder(promoterId);
        return userPuts;
    }

    @Override
    public void updateUserPutIsContant(Integer recordId) {
                UserPut userPut = new UserPut();
                userPut.setRecordId(recordId);
                userPut.setIsContact(1);
                userPutMapper.updateByPrimaryKeySelective(userPut);
    }

    @Override
    public void updateUserPutReceiptContent(Integer recordId, String receiptContent) {
        UserPut userPut = new UserPut();
        userPut.setRecordId(recordId);
        userPut.setReceiptContent(receiptContent);
        userPutMapper.updateByPrimaryKeySelective(userPut);
    }

    @Override
    public void addpromoterArea(String areaIdList,Integer userId) {
        String [] areas = areaIdList.split(",");
        Area area =null;
        Example example = new Example(Area.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("userId",userId);
        areaMapper.deleteByExample(example);


        List<Area> areaList = new ArrayList<>();
        for (String area1 : areas) {
            area  = new Area();
            area.setUserId(userId);
            area.setIsDeleted(1);
            area.setAreaId(Integer.parseInt(area1));
            areaList.add(area);
        }
        areaMapper.insertList(areaList);
        areaList= null;
        area= null;
    }

    @Override
    public List<Area> listMyArea(Integer userId) {
        Example example = new Example(Area.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("userId",userId);
        criteria.andEqualTo("isDeleted",1);
        List<Area> areas = areaMapper.selectByExample(example);
        return areas;
    }

    @Override
    public Map advLogin(String userTel, String userPass) {
        Example example = new Example(User.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("userTel",userTel).andEqualTo("userPassword",userPass);
        User user = userMapper.selectOneByExample(example);
        Map map = new HashMap();
        if(user==null){
            map.put("flag","error");
            map.put("msg", "账号或密码错误");
            return map;
        }
        if(user.getUserStatus()==0){
            map.put("flag","error");
            map.put("msg", "该用户当前处于冻结状态");
            return map;
        }
        map.put("flag","success");
        map.put("user", user);
        return map;
    }

    @Override
    public Map listUserAdvShop(Integer userId) {
        Example example = new Example(Area.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("userId",userId).andEqualTo("isDeleted",1);
        List<Area> areas = areaMapper.selectByExample(example);
        List<Integer> list = new ArrayList<>();
        for (Area area : areas) {
            list.add(area.getAreaId());
        }

        example = new Example(Shop.class);
        criteria = example.createCriteria();
        criteria.andIn("shopRegion",list);
        List<Shop> shops = shopMapper.selectByExample(example);
        map = new HashMap();
        map.put("area", list);
        map.put("shops",shops);
        return map;
    }

    @Override
    public Map payOrder(Integer recordId, String payMoney, String openId,HttpServletRequest request) {
        try{



            String notifyurl = "https://www.ccclkj.cn:2036/user/paySuccess";

            String nonceStr = String.valueOf(new Date().getTime());
            String orderId =nonceStr+"A"+((int) (Math.random() * 90) + 10);
            String attach =recordId+"" ;

            String Ip = Util.getIpAddr(request);
            String totalFee = Util.getMoney(payMoney);

            String notify_url = notifyurl;
            String trade_type = "JSAPI";
            String body = "意向单定金";
            String out_trade_no = orderId;
            SortedMap<String, Object> packageParams = new TreeMap();
            packageParams.put("appid", WxApi.getWxAppId());
            packageParams.put("mch_id", WxApi.getMchId());
            packageParams.put("nonce_str", nonceStr);
            packageParams.put("body", body);
            packageParams.put("attach", attach);
            packageParams.put("out_trade_no", out_trade_no);
            packageParams.put("total_fee", totalFee);
            packageParams.put("spbill_create_ip", Ip);
            packageParams.put("notify_url", notify_url);
            packageParams.put("trade_type", trade_type);
            packageParams.put("openid", openId);
            RequestHandler reqHandler = new RequestHandler(null, null);
            reqHandler.init(WxApi.getWxAppId(), WxApi.getWxAppSecret(), WxApi.getPartnerkey());
            String sign = reqHandler.createSign(packageParams);
            String xml = "<xml><appid>" + WxApi.getWxAppId() + "</appid>" + "<mch_id>" + WxApi.getMchId()
                    + "</mch_id>" + "<nonce_str>" + nonceStr + "</nonce_str>"
                    + "<sign>" + sign + "</sign>" + "<body><![CDATA[" + body
                    + "]]></body>" + "<out_trade_no>" + out_trade_no
                    + "</out_trade_no>" + "<attach>" + attach + "</attach>"
                    + "<total_fee>" + totalFee + "</total_fee>"
                    + "<spbill_create_ip>" + Ip
                    + "</spbill_create_ip>" + "<notify_url>" + notify_url
                    + "</notify_url>" + "<trade_type>" + trade_type
                    + "</trade_type>" + "<openid>" + openId + "</openid>"
                    + "</xml>";
            String prepay_id = "";
            String createOrderURL = "https://api.mch.weixin.qq.com/pay/unifiedorder";
            String result = PayUtil.httpRequest(createOrderURL, "POST", xml);
            System.out.println(result);
            // 将解析结果存储在HashMap中
            SortedMap<String, Object> finalpackage = new TreeMap();
            try {
                Map map = PayUtil.doXMLParse(result);
                String return_code = (String) map.get("return_code");// 返回状态码
                if (return_code.equals(return_code)) {
                    prepay_id = (String) map.get("prepay_id");// 返回的预付单信息
                    String timestamp =String.valueOf(System.currentTimeMillis()/1000);
                    String packages = "prepay_id=" + prepay_id;
                    finalpackage.put("appId", WxApi.getWxAppId());
                    finalpackage.put("timeStamp", timestamp);
                    finalpackage.put("nonceStr", nonceStr);
                    finalpackage.put("package", packages);
                    finalpackage.put("signType", "MD5");
                    String finalsign = reqHandler.createSign(finalpackage);
                    finalpackage.put("paySign", finalsign);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
            return finalpackage;
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }

    @Override
    public void paySuccess(HttpServletRequest request, HttpServletResponse response) {

        System.out.println( "进来了");
        String resXml = "";
        InputStream inStream;
        try {
            inStream = request.getInputStream();
            ByteArrayOutputStream outSteam = new ByteArrayOutputStream();
            byte[] buffer = new byte[1024];
            int len = 0;
            while ((len = inStream.read(buffer)) != -1) {
                outSteam.write(buffer, 0, len);
            }
            outSteam.close();
            inStream.close();
            String result = new String(outSteam.toByteArray(), "utf-8");// 获取微信调用我们notify_url的返回信息
            Map m = PayUtil.parseXmlToList2(result);
            BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream());
            if ("SUCCESS".equals(m.get("result_code").toString())) {
//                // 更新支付状态
                // 获取微信生成的订单号
                String attach = m.get("attach").toString();
                UserPut userPut = new UserPut();
                userPut.setRecordId(Integer.parseInt(attach));
                userPut.setPayStatus(1);
                userPut.setPayDate(DateFormatHelper.currentTimes());
                userPutMapper.updateByPrimaryKeySelective(userPut);

                //更新门店状态为已占用
                //获取门店
                userPut = userPutMapper.selectByPrimaryKey(attach);
                Example example = new Example(Shop.class);
                Example.Criteria criteria = example.createCriteria();
                criteria.andIn("shopId", Arrays.asList(userPut.getShopId().split(",")));
                Shop shop = new Shop();
                shop.setShopStatus("2");
                shopMapper.updateByExampleSelective(shop,example);
                shop = null;
                example =null;
                criteria = null;

                //锁定3天  72
                redisTemplate.opsForValue().set("recordId"+attach,attach);
                task(userPut.getShopId(),attach,72);

                resXml = "<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml> ";

            } else {
                resXml = "<xml><return_code><![CDATA[FAIL]]></return_code><return_msg><![CDATA[报文为空]]></return_msg></xml>";

            }
            out.write(resXml.getBytes());
            out.flush();
            out.close();
        } catch (IOException e) {
            e.printStackTrace();
        }

    }



    @Override
    public void addUserVisit(ShopVisit shopVisit, HttpServletRequest request) {
        String contentType = request.getContentType();
        if(contentType.contains("multipart/form-data")){
            MultipartFile file = ((MultipartRequest) request).getFile("file");
            if (file != null) {
                String img  = OSSUtil.uploadingImg(file,"xiuzheng/shop");
                shopVisit.setVisitPic(img);
            }
        }
        shopVisit.setVisitDate(DateFormatHelper.currentTimes());
        shopVisit.setVisitApply(0);
        Example example = new Example(Setting.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("settingId",1);
        Setting setting = settingMapper.selectOneByExample(example);
        shopVisit.setMoney(setting.getMoney());
        shopVisitMapper.insertSelective(shopVisit);
        if(shopVisit.getIsFirst()==1){
            Shop shop = new Shop();
            shop.setShopId(shopVisit.getShopId());
            shop.setShopLng(shopVisit.getVisitLng());
            shop.setShopLat(shopVisit.getVisitLat());
            shop.setBusinessStatus(shopVisit.getShopStatus());
            shop.setShopMainLabel(shopVisit.getShopLabel());
            shopMapper.updateByPrimaryKeySelective(shop);
        }


    }

    @Override
    public Map shopVisitCount(Integer userId) {
//       Example example = new Example(ShopVisit.class);
//       Example.Criteria criteria = example.createCriteria();
//       criteria.andEqualTo("userId",userId);
       List<ShopVisit> shopVisit =shopVisitMapper.selectVisitByUser(userId);// shopVisitMapper.selectByExample(example);
       map = new HashMap<String, Object>();
       map.put("shopVisit",shopVisit);
        return map;
    }

    @Override
    public PageInfo listShopVisit(Integer page, Integer size, Integer userId, Integer status) {
        PageHelper.startPage(page,size);
        return new PageInfo(shopVisitMapper.selectVisit(userId,status));
    }

    @Override
    public void applyShopVisit(String ids, Integer status, String applyNote) {
        Example example = new Example(ShopVisit.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andIn("visitId",Arrays.asList(ids.split(",")));
        ShopVisit shopVisit = new ShopVisit();
        shopVisit.setVisitApply(status);
        shopVisit.setApplyNote(applyNote);
        shopVisitMapper.updateByExampleSelective(shopVisit,example);
        if (status==1){
            if (ids!=null && ids!=""){
                List<String> list = Arrays.asList(ids.split(","));
                for (String id:list){
                    Example example1 = new Example(ShopVisit.class);
                    Example.Criteria criteria1 = example1.createCriteria();
                    criteria1.andEqualTo("visitId",Integer.parseInt(id));
                    ShopVisit shopVisit1 = shopVisitMapper.selectOneByExample(example1);
                    User user = userMapper.selectByPrimaryKey(shopVisit1.getUserId());
                    user.setUserBalance(user.getUserBalance()+shopVisit1.getMoney());
                    userMapper.updateByPrimaryKeySelective(user);
                }
            }
        }

    }

    @Override
    public Double UserBalance(Integer userId) {
        return userMapper.selectByPrimaryKey(userId).getUserBalance();
    }

    @Override
    public UserImg listUserImg(Integer userId) {

        return userMapper.selectUserImg(userId);
    }

    @Override
    public void updatePass(Integer userId, String  pass) {
        User user = new User();
        user.setUserId(userId);
        user.setUserPassword(pass);
        userMapper.updateByPrimaryKeySelective(user);

    }
    @Override
    public void updateShopStatus(String shopIds,String recordsId) {
        Example example = new Example(Shop.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andIn("shopId", Arrays.asList(shopIds.split(",")));
        Shop shop = new Shop();
        shop.setShopStatus("0");
        shopMapper.updateByExampleSelective(shop,example);

        UserPut put = new UserPut();
        put.setRecordId(Integer.parseInt(recordsId));
        put.setIsPut(2);
        userPutMapper.updateByPrimaryKeySelective(put);
        redisTemplate.delete("recordId"+recordsId);
//        shop = null;
//        example =null;
//        criteria = null;
        System.out.println("有没有执行这列");

    }

    @Override
    public void test(Integer flag)
    {
        if(flag==0){

            task("9025,26,27,28,29,30","58",30);
            redisTemplate.opsForValue().set("recordId58",58);
        }else{

            redisTemplate.delete("recordId58");
            System.out.println("删除了");
        }

    }

    @Override
    public List<User> listGMoney(String time, Integer userId) {

        return userMapper.listGMoney(time,userId);
    }

    @Override
    public String addMiniUser(String userName, String userPassword, String userTel) {
        //判断用户是否存在
        Example example = new Example(UserMini.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("userTel",userTel);
        //存在返回该用户已存在，不存在则添加该用户
        if(!userMiniMapper.selectByExample(example).isEmpty()){
            return "0";
        }
        UserMini user = new UserMini();
        user.setUserName(userName);
        user.setUserPassword(userPassword);
        user.setUserTel(userTel);
        userMiniMapper.insertSelective(user);
        return "1";

    }

    @Override
    public UserMini userMinilogin(String userTel, String userPassword) {
        Example example = new Example(UserMini.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("userTel",userTel);
        criteria.andEqualTo("userPassword",userPassword);
        UserMini userMini = userMiniMapper.selectOneByExample(example);
        return userMini;
    }


    private void  task(String shopIds,String  recordId,Integer time){
        ScheduledExecutorService execute = Executors.newScheduledThreadPool(1);
        //创建任务
        CloseTask task = new CloseTask(shopIds,recordId);
        //安排任务的执行时间
        execute.schedule(task,time,TimeUnit.HOURS);
        execute.shutdown();
    }


}
